 /**
 * Description: 版本历史
 * @author:jacky
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2018-07-05   jacky       1.0.0     Initial
 */
package com.metro.demo.biz.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.demo.biz.mapper.IBizVersionHistoryMapper;
import com.metro.demo.biz.service.inf.IBizVersionHistoryService;
import com.metro.demo.biz.beans.vo.BizVersionHistory;

 /**
 * 版本历史<br>
 *
 * @author:jacky
 * @since:1.0.0
 * @version [1.0.0, 2018-07-05]
 */
@Service("bizversionhistoryService")
public class BizVersionHistoryService extends BaseServiceSupport<BizVersionHistory> implements IBizVersionHistoryService{
    //版本历史Mapper
    @Autowired
    private IBizVersionHistoryMapper bizversionhistoryMapper;

    @Override
    public IMapper getMapper() {
        return bizversionhistoryMapper;
    }

    @Override
    public IResult save(BizVersionHistory entity) {
        try {
            bizversionhistoryMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增版本历史失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(BizVersionHistory entity) {
        try {
            bizversionhistoryMapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改版本历史失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            bizversionhistoryMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            bizversionhistoryMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }
}